<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="java.net.InetAddress" %>
<%
	String pernr 	= (request.getParameter("pernr") != null) ? 	request.getParameter("pernr") 	 : "";
	String company  = (request.getParameter("company") != null) ? 	request.getParameter("company")  : "";
	String language	= (request.getParameter("language") != null) ? 	request.getParameter("language")  : "ko";
	String key		= (request.getParameter("key") != null) ? 	request.getParameter("key")  : "";
	String timeout 	= (request.getParameter("timeout") != null) ? 	request.getParameter("timeout")  : "0";
	
	String I_YEA 		= (request.getParameter("I_YEA") != null) ? 	request.getParameter("I_YEA")  : "";
	String startModule 	= (request.getParameter("startModule") != null) ? 	request.getParameter("startModule")  : "";	
	
	String myIP		= request.getRemoteAddr();
	if(company == "" || pernr=="") {
		System.out.println("Error in main.jsp company = '" + company +"' pernr='" + pernr +"' ip='" + myIP +"'");
	}
	
	String companyForEacc = "";
	if(company.equals("SAC") ) {
		companyForEacc = "ACE";
	} else if(company.equals("STC") ) {
		companyForEacc = "TOP";
	} else if(company.equals("NOS") ) {
		companyForEacc = "ONS";
	}
	System.out.println("companyForEacc = " + companyForEacc);
	
	String serverIP = InetAddress.getLocalHost().getHostAddress();
	String serverType;
	if(serverIP.equals("10.40.17.43")) {
		serverType = "QA";
	}
	else if(serverIP.equals("10.40.17.42")) { 
		serverType = "PROD";
	}
	else if(serverIP.equals("10.40.17.39")) { 
		serverType = "DEV";
	}
	else {
		serverType = "unknown";
	}
%>

<!-- saved from url=(0014)about:internet -->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<TITLE>SK Telecom Common Infra e-HR</TITLE>
<!--  BEGIN Browser History required section -->
<link rel="stylesheet" type="text/css" href="history/history.css" />
<!--  END Browser History required section -->
<script src="AC_OETags.js" language="javascript"></script>

<!--  BEGIN Browser History required section -->
<!-- 
<script src="history/history.js" language="javascript"></script>
 -->
<!--  END Browser History required section -->
<style>
body { margin: 0px; overflow:hidden }
</style>
<script language="JavaScript" type="text/javascript">
// -----------------------------------------------------------------------------
// Globals
// Major version of Flash required
var requiredMajorVersion = 10;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Minor version of Flash required
var requiredRevision = 22;
// -----------------------------------------------------------------------------
// Version check for the Flash Player that has the ability to start Player Product Install (6.0r65)
// -->
</script>


<Script Language ="JavaScript">
	function OnInit() 
	{	
		<%
		if(!company.equals("SAC") ) {
		%>
		return;
		<%			
		}
		%>
		//alert('<%=companyForEacc%>@@<%=company%>');
		if (document.OfficeXVSCtrl.SetKey( "SlipSKT@C:\\WNS Files\\SlipSKT" ))
 	  	{
	            var nUpdate = document.OfficeXVSCtrl.Check( 'http://10.40.17.73/<%=companyForEacc%>/UpdateFiles', 'ImageLibrary|ImageLibrary2|OfficeDOC|FormFiles|DocFiles|ClientFiles2|System|PrintXDOC' ); 
        	    document.OfficeXVSCtrl.UpdateAll( '' );
		        document.OfficeXVSCtrl.RegistFiles();
		}	
		//alert('OnInit end');
 	}	
</SCRIPT>
<SCRIPT LANGUAGE="javascript" FOR="OfficeXVSCtrl" EVENT="XVSEvent(event)">
    if (event == "SUCCESS")
    {
        //증빙 업데이트 성공
    	//alert('update finish');
    }
    else 
    {
        alert("전자증빙 프로그램 업데이트 실패\r\n\r\n관리자에게 문의하세요!!!");
    }
</SCRIPT>  
</head>


<body scroll="no" oncontextmenu="return false" ondragstart="return false" onselectstart="return false" onload="OnInit(); window.opener.custom_close();"> 




<script language="JavaScript" type="text/javascript">
/*
alert(window.opener);
if(window.opener!=null ) {
	window.opener.custom_close();
}
*/
<!--
//Version check for the Flash Player that has the ability to start Player Product Install (6.0r65)
var hasProductInstall = DetectFlashVer(6, 0, 65);
//Version check based upon the values defined in globals
var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);

if ( hasProductInstall && !hasRequestedVersion ) {
	// DO NOT MODIFY THE FOLLOWING FOUR LINES
	// Location visited after installation is complete if installation is required
	var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
	var MMredirectURL = window.location;
    document.title = document.title.slice(0, 47) + " - Flash Player Installation";
    var MMdoctitle = document.title;
	flashPlayLink();
} else if (hasRequestedVersion) {
	// if we've detected an acceptable version
	// embed the Flash Content SWF when all tests are passed
	
	AC_FL_RunContent(
			"src", "eHRMain",
			"width", "100%",
			"height", "100%",
			"align", "middle",
			"id", "eHRMain",
			"quality", "high",
			"bgcolor", "#ffffff",
			"name", "eHRMain",
			"wmode", "transparent",
			"allowScriptAccess","sameDomain",
			"type", "application/x-shockwave-flash",
			"pluginspage", "http://www.adobe.com/go/getflashplayer"
	);
	} else {  // flash is too old or we can't detect the plugin
		 /*
		  var alternateContent = 'Alternate HTML content should be placed here. '
			+ 'This content requires the Adobe Flash Player. '
		 	+ '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>';
		  document.write(alternateContent);  // insert non-flash content
		    */
		    flashPlayLink();
	}


function flashPlayLink(){
	var alternateContent = "<meta http-equiv='refresh' content='2;url= http://www.adobe.com/go/getflash/'>"
		  + "<style type='text/css'>"
		  + "<!--"
		  + ".style1 {"
		  + "	color: #FFFFFF;"
		  + "	font-weight: bold;"
		  + "	font-size: 13px;"
		  + "	line-height: 1.5;"
		  + "}"
		  + "-->"
		  + "</style>"
		  + "</head>"
		  + "<body>"
		  + "<table width='100%' height='100%' border='0'>"
		  + "  <tr>"
		  + "    <td><table width='410' height='221' border='0' align='center' background='ehr_open.jpg'>"
		  + "      <tr>"
		  + "        <td width='185'>&nbsp;</td>"
		  + "        <td width='185'>&nbsp;</td>"
		  + "        <td width='26'>&nbsp;</td>"
		  + "      </tr>"
		  + "      <tr>"
		  + "        <td>&nbsp;</td>"
		  + "        <td valign='top'><div align='center'><span class='style1'><br>Flash Play 버전을 <br>"
		  + "       업그래이드 합니다.<br><br>"
		  + "        페이지를 자동이동 합니다.</span></div></td>"
		  + "        <td>&nbsp;</td>"
		  + "      </tr>"
		  + "    </table></td>"
		  + "  </tr>"
		  + "</table>"
		  + "</body>";
		    document.write(alternateContent);
}
//사번을 리턴한다.
function getUserid()
{
	return "<%=pernr %>";
}

function getCompany() 
{
	return '<%=company%>';
}

function getLanguage()
{
	return '<%=language%>';
}

function getDataSource()
{
	return "<%=company%>";
}

function getTimeout()
{
	return "<%=timeout%>";
}


function getI_YEA()
{
	return "<%=I_YEA%>";
}


function getstartModule()
{
	return "<%=startModule%>";
}



function myIP()
{
	return "<%=myIP%>";
}

function serverType()
{
	return "<%=serverType%>";
}




// 전자증빙 첨부
var sEacc = "empty";
function getEacc()
{
	return sEacc;
}

function initEacc()
{
	sEacc = "empty";
	return "init complete"; 
}

function callEacc(val) 
{
	sEacc = val;
//	thisMovie("eHRMain").callBackEacc(); 
}

// 결재폼 전송
var sFormAttach = "empty";
function getFormAttach()
{
	return sFormAttach;
}

function initFormAttach()
{
	sFormAttach = "empty";
	return "init complete"; 
}

function callFormAttach(val) 
{
	sFormAttach = val;
//	thisMovie("eHRMain").callBackEacc(); 
}




function thisMovie(movieName) {
	if (navigator.appName.indexOf("Microsoft") != -1) {
		alert('win');
		return window[movieName];
	}
	else {
		alert('win else');
		return document[movieName];
	}
}

//전자결제 품의서 HTML팝업창
//function execPopUpWindow(content, param){
	function execPopUpWindow(param){

	 var t_width = 610;
     var t_height = 510;
     var x = (screen.availWidth - t_width) / 2;
     var y = (screen.availHeight - t_height) / 2;
	 window.open ('','PRINTAPPROVAL','channelmode=no,status=no,width='+t_width+',height='+t_height+',left='+x+',top='+y+',scrollbars=yes,toolbars=no,resizable=yes');
	 document.form2.target = 'PRINTAPPROVAL';
	 document.form2.content.value = param.content;
	 document.form2.ctitle.value = param.title;
	 document.form2.writer.value = param.AppLine.writer;
	 document.form2.reviewer1.value = param.AppLine.reviewer1;
	 document.form2.reviewer2.value = param.AppLine.reviewer2;
	 document.form2.reviewer3.value = param.AppLine.reviewer3;
	 document.form2.responsible.value = param.AppLine.responsible;
	 document.form2.date1.value = param.AppDate.writer;
	 document.form2.date2.value = param.AppDate.reviewer1;
	 document.form2.date3.value = param.AppDate.reviewer2;
	 document.form2.date4.value = param.AppDate.reviewer3;
	 document.form2.date5.value = param.AppDate.responsible;

	 document.form2.CoCode.value = param.CoCode;
	 document.form2.HgCode.value = param.HgCode;
	 document.form2.HgName.value = param.HgName;
	 document.form2.UserId.value = param.UserId;
	 document.form2.UserName.value = param.UserName;
	 document.form2.Sid.value = param.Sid;
	 document.form2.KeyWord.value = param.KeyWord;
	 document.form2.SlipdocKey.value = param.SlipdocKey;
	 
	 document.form2.action = 'PrintApproval.jsp';
	 if(navigator.appVersion.indexOf('MSIE 7.0')>=0) {
	 	window.opener = self;
	 }
	 
	 document.form2.submit();
}

//전자결제 품의서 HTML팝업창
function eaccount_PopUpWindow(param){
	 
	 var t_width = 400;
     var t_height = 500;
     var x = (screen.availWidth - t_width) / 2;
     var y = (screen.availHeight - t_height) / 2;
	 window.open ('','EACT_PRINTAPPROVAL','channelmode=no,status=no,width='+t_width+',height='+t_height+',left='+x+',top='+y+',scrollbars=yes,toolbars=no,resizable=yes');
	 document.form3.target = 'EACT_PRINTAPPROVAL';


	 document.form3.CoCode.value = param.CoCode;
	 document.form3.HgCode.value = param.HgCode;
	 document.form3.HgName.value = param.HgName;
	 document.form3.UserId.value = param.UserId;
	 document.form3.UserName.value = param.UserName;
	 document.form3.Sid.value 		= param.Sid;
	 document.form3.KeyWord.value = param.KeyWord;
	 document.form3.SlipdocKey.value = param.SlipdocKey;

	 //조회시
	 document.form3.ConnKey.value = param.ConnKey;
	 
	 document.form3.action = 'eaccountAtvx.jsp';
	 if(navigator.appVersion.indexOf('MSIE 7.0')>=0) {
	 	window.opener = self;
	 }
	 
	 document.form3.submit();
}

//전자결제 품의서 HTML팝업창
function eaccount_PopUpWindow_Read(param){
	 
	 var t_width = 400;
     var t_height = 500;
     var x = (screen.availWidth - t_width) / 2;
     var y = (screen.availHeight - t_height) / 2;
	 window.open ('','EACT_PRINTAPPROVAL','channelmode=no,status=no,width='+t_width+',height='+t_height+',left='+x+',top='+y+',scrollbars=yes,toolbars=no,resizable=yes');
	 document.form3.target = 'EACT_PRINTAPPROVAL';


	 document.form3.CoCode.value = param.CoCode;
	 document.form3.HgCode.value = param.HgCode;
	 document.form3.HgName.value = param.HgName;
	 document.form3.UserId.value = param.UserId;
	 document.form3.UserName.value = param.UserName;
	 document.form3.Sid.value = param.Sid;
	 
	 document.form3.KeyWord.value = param.KeyWord;
	 document.form3.SlipdocKey.value = param.SlipdocKey;

	 //조회시
	 document.form3.ConnKey.value = param.ConnKey;
	 
	 document.form3.action = 'eaccountAtvx_Read.jsp';
	 if(navigator.appVersion.indexOf('MSIE 7.0')>=0) {
	 	window.opener = self;
	 }
	 
	 document.form3.submit();
}
// -->
</script>

	<%
	if(company.equals("SAC") ) {
	%>
		<object classid='clsid:D6A7F8CC-480D-4E86-905E-00CA35A53757' id='OfficeXVSCtrl' codebase='http://10.40.17.73/<%=companyForEacc%>/OfficeXVS.cab#version=5,0,1,3' width='0' height='0'>
		<param name='_Version' value='65536'>
		<PARAM NAME='_ExtentX' VALUE='2646'>
		<PARAM NAME='_ExtentY' VALUE='1323'>
		<PARAM NAME='_StockProps' VALUE='0'>
		</object>
	<%			
	}
	%>


<noscript>
  	<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="eHRMain" width="100%" height="100%" 
			codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
			<param name="movie" value="eHRMain.swf" />
			<param name="quality" value="high" />
			<param name="bgcolor" value="#ffffff" />
			<param name="allowScriptAccess" value="sameDomain" />
			<embed src="eHRMain.swf" quality="high" bgcolor="#ffffff"
				width="100%" height="100%" name="eHRMain" align="middle"
				play="true"
				loop="false"
				wmode="transparent"
				quality="high"
				allowScriptAccess="sameDomain"
				type="application/x-shockwave-flash"
				pluginspage="http://www.adobe.com/go/getflashplayer">
			</embed>
	</object>

	
</noscript>
<form name='form2' method=post>
	<input id="content" type='hidden' name='content'>
	<input id="ctitle" type='hidden' name='ctitle'>
	<input id="writer" type='hidden' name='writer'>
	<input id="reviewer1" type='hidden' name='reviewer1'>
	<input id="reviewer2" type='hidden' name='reviewer2'>
	<input id="reviewer3" type='hidden' name='reviewer3'>
	<input id="responsible" type='hidden' name='responsible'>
	<input id="date1" type='hidden' name='date1'>
	<input id="date2" type='hidden' name='date2'>
	<input id="date3" type='hidden' name='date3'>
	<input id="date4" type='hidden' name='date4'>
	<input id="date5" type='hidden' name='date5'>
	
	<input id="CoCode" type='hidden' name='CoCode'>
	<input id="HgCode" type='hidden' name='HgCode'>
	<input id="HgName" type='hidden' name='HgName'>
	<input id="UserId" type='hidden' name='UserId'>
	<input id="UserName" type='hidden' name='UserName'>
	<input id="KeyWord" type='hidden' name='KeyWord'>
	<input id="SlipdocKey" type='hidden' name='SlipdocKey'>
	<input id="ConnKey" type='hidden' name='ConnKey'>	
	<input id="Sid" type='hidden' name='Sid'>
</form>	



<form name='form3' method=post>
	<input id="CoCode" type='hidden' name='CoCode'>
	<input id="HgCode" type='hidden' name='HgCode'>
	<input id="HgName" type='hidden' name='HgName'>
	<input id="UserId" type='hidden' name='UserId'>
	<input id="UserName" type='hidden' name='UserName'>
	<input id="KeyWord" type='hidden' name='KeyWord'>
	<input id="SlipdocKey" type='hidden' name='SlipdocKey'>
	<input id="ConnKey" type='hidden' name='ConnKey'>
	<input id="Sid" type='hidden' name='Sid'>
</form>	

</body>
</html>